package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.CheckGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckGroupDao {
    @Delete("delete from t_checkgroup where id = #{id}")
    void deleteById(Integer id);

    @Select("select * from t_checkgroup")
    List<CheckGroup> findAll();

    @Select("select * from t_checkgroup where id = #{id}")
    CheckGroup findById(Integer id);

    Page<CheckGroup> findPage(QueryPageBean queryPageBean);

    @Select("select t_setmeal_checkgroup.checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{setmealId}")
    List<Integer> findCheckGroupIdsBySetmealId(Integer setmealId);

    void add(CheckGroup checkGroup);

    void addCheckGroupAndCheckItem(Integer checkGroupId, Integer checkitemId);

    void update(CheckGroup checkGroup);

    void deleteCheckGroupAndCheckItem(Integer checkGroupId);
}
